package com.ybf.user.dal.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum DataScopeEnum {

    ALL(0, "全部数据权限"),

    CUSTOM(1, "自定数据权限"),

    AREA(2, "本院区数据权限"),

    DEPARTMENT(3, "本部门数据权限");

    private Integer code;

    private String desc;


    public static DataScopeEnum getByCode(Integer code) {
        return Arrays.stream(DataScopeEnum.values()).filter(e -> Objects.equals(e.getCode(), code))
                .findFirst().orElse(null);
    }
}
